package prototype;

import java.util.HashMap;
import java.util.Map;

public class ShapeRegistry {

    private static final ShapeRegistry INSTANCE = new ShapeRegistry();

    private final Map<String, Shape> registry = new HashMap<>();

    private ShapeRegistry() {
    }

    public static ShapeRegistry getInstance() {
        return INSTANCE;
    }

    public void addShape(String key, Shape shape) {
        registry.put(key, shape);
    }

    public Shape getShape(String key) {
        return (Shape) registry.get(key).clone();
    }
}
